Refactor: Move all precompiles into crates/{pallet}/precompiles/ folder#307
Conversation
danielbui12
commented
Jul 22, 2026
- Move the three pallet_revive precompile crates under crates/precompiles/, dropping the redundant -precompile directory suffix (package names unchanged)
- Update workspace members and path dependencies in the root Cargo.toml
- Move the three pallet_revive precompile crates under crates/precompiles/, dropping the redundant -precompile directory suffix (package names unchanged) - Update workspace members and path dependencies in the root Cargo.toml - Update license-header globs and path references in CONTRIBUTING.md, CLAUDE.md, docs/design/smart-contracts.md, and examples/contracts/README.md
bkontur
left a comment
There was a problem hiding this comment.
@danielbui12 I am checking, how we did precompiles in Polkadot SDK, and I would like to keep the same pattern here and align those:
- Keep precompiles next to their pallet — in polkadot-sdk each precompile crate sits in a precompiles/ folder right beside the pallet it wraps (frame/assets/precompiles, frame/vesting/precompiles, xcm/pallet-xcm/precompiles), rather than all bundled in one central spot. If these belong to a specific pallet, popping them next to it keeps us consistent. (If they're genuinely standalone, a shared crates/precompiles/ is totally fine — just flagging the upstream habit.)
- .sol location — upstream keeps the interface either at the crate root or in src/interface/ (like pallet-xcm/precompiles/src/interface/IXcm.sol). We're putting it straight in src/, so maybe move it to src/interface/I*.sol to match?
wdyt?
Everything else already matches nicely (package names, the lib.rs/mock.rs/tests.rs layout, etc).
|
@bkontur I'm okay with it, let's follow polkadot-sdk pattern |
- Relocate the three precompile crates from crates/precompiles/* to crates/pallets/*/precompiles/ - Move Solidity interface files into a src/interface/ subfolder and update the alloy::sol! paths - Update workspace members and dependency paths in the root Cargo.toml - Update directory references in CLAUDE.md, CONTRIBUTING.md, docs/design/smart-contracts.md, and examples/contracts/README.md - Adjust licenserc.apache.toml include patterns for the new layout
crates/precompiles/ foldercrates/{pallet}/precompiles/ folder
| use tracing::error; | ||
|
|
||
| alloy::sol!("src/IDriveRegistry.sol"); | ||
| alloy::sol!("src/interface/IDriveRegistry.sol"); |
There was a problem hiding this comment.
I see there is also possibility to write the interface directly to the rs file alloy::sol! {, not sure which one is better
There was a problem hiding this comment.
I remember that I tried several approaches, and Cisco's Photo App PRs also mentioned this issue before. It seems to be due to revive's poor support for this
# Conflicts: # CLAUDE.md
|
/cmd fmt |
|
@bkontur It is due to an unexpected job cancellation. It happens several times, just re-run job, then it works |